package demo;

/**
 * 非终结表达式，具体返回值由终结表达式决定
 * @author ZhouWeiBo
 * @create 2022/6/8
 */
public class NonTerminalExpression implements Expression{
    private Expression[] expressions;

    public NonTerminalExpression(Expression... expressions) {
        this.expressions = expressions;
    }


    @Override
    public boolean interpret(Person person) {
        for (Expression exp :expressions){
            if (!exp.interpret(person)){
                return false;
            }
        }
        return true;
    }
}
